import request from '../utils/request'

// 获取所有分类
export function getCategories() {
    return request({
        url: '/category',
        method: 'get'
    })
}

// 新增分类
export function addCategory(data) {
    return request({
        url: '/category',
        method: 'post',
        data
    })
}

// 更新分类
export function updateCategory(id, data) {
    return request({
        url: `/category/${id}`,
        method: 'put',
        data
    })
}

// 删除分类
export function deleteCategory(id) {
    return request({
        url: `/category/${id}`,
        method: 'delete'
    })
}